/**
 * desc: 任务相关接口
 */

import request from '../../utils/request'

// 新建任务
const newJob = (data) => {
  return request({
    url: '/api/job',
    method: 'POST',
    data
  })
}
//公域任务列表
const commonJob = (data) => {
  return request({
    url: '/api/common-job/page',
    method: 'GET',
    data
  })
}
//发布公域任务
const newCommonJob = (data) => {
  return request({
    url: '/api/common-job',
    method: 'POST',
    data
  })
}
//领取公域任务
const getCommonJob = (id,data) => {
  return request({
    url: '/api/common-job/'+id,
    method: 'put',
    data
  })
}
//查看任务
const getDayJob = (data) => {
  return request({
    url: '/api/job/day',
    method: 'GET',
    data
  })
}
//查看同事任务
const getColleague = (data) => {
  return request({
    url: '/api/job/day',
    method: 'GET',
    data
  })
}
//修改任务状态
const settingCheckbox = (id) => {
  return request({
    url: '/api/job/'+id+'/setting',
    method: 'GET'
  })
}

//获取任务
const getjob = (id) => {
  return request({
    url: '/api/job/'+id,
    method: 'GET'
  })
}
//备注任务
const setRemark = (id,data) => {
  return request({
    url: '/api/job/'+id,
    method: 'PUT',
    data
  })
}

//获取时间，如果之前有未完成的任务则跳到之前的时间
const getLastTime = () => {
  return request({
    url: '/api/job/lasttime',
    method: 'get'
  })
}
//Menu列表
const getunfinish = () => {
  return request({
    url: '/cms/menu/unfinish',
    method: 'get'
  })
}
//同事任务列表
const jobTeam = () => {
  return request({
    url: '/api/job/team',
    method: 'get'
  })
}

// 编辑公域任务
const commonEditor = (id,data) => {
  return request({
    url: '/api/common-job/editor/'+id,
    method: 'PUT',
    data
  })
}


module.exports = {
  newJob,
  commonJob,
  newCommonJob,
  getCommonJob,
  getDayJob,
  settingCheckbox,
  getjob,
  setRemark,
  getLastTime,
  getunfinish,
  jobTeam,
  getColleague,
  commonEditor
}